def delete():
    mark = True
    while mark:
        stdId = input("需要删除的学生ID: ")
        if stdId != "":
            if os.path.exists(filename):
                with open(filename,'r') as rfile:
                    student_old = rfile.readlines()
            else:
                student_old = []
            ifdel = False
            if student_old:
                with open(filename,'w') as wfile:
                    d = {}
                    for list in student_old:
                        d = dict(eval(list))
                        if d['id'] != stdId:
                            wfile.write(str(d)+"\n")
                        else:
                            ifdel = True
                    if ifdel:
                        print("ID为 %s 的学生信息已经被删除" % stdId)
                    else:
                        print("没有找到ID为 %s 的学生信息"% stdId)
            else:
                print("无该学生信息")
                break
            show()
            inputMark = input("是否继续添加？(y/n)：")
            if inputMark == "y":
                mark = True
            else:
                mark = False